<!-- 开放管理-数据分析-预约大屏 -->
<template>
<!--日历自定义显示内容-->
  <div class="JNPF-common-search-box">
      <div style="text-align: left;">
          <el-select v-model="value" placeholder="请选择教学楼">
            <el-option
              v-for="item in options1"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
         </el-select>

         <el-select v-model="value" placeholder="请选择楼层">
            <el-option
              v-for="item in options2"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
         </el-select>

      </div>

      <el-calendar>
          <template slot="dateCell" slot-scope="{date, data}">
              {{ data.day.split('-').slice(1).join('-') }}
              <el-tag type="danger" v-if="scheduleData[data.day]">
                  {{scheduleData[data.day].content}}
              </el-tag>
              <!-- </div> -->
          </template>
      </el-calendar>
  </div>

</template>

<script>
  import jnpf from "@/utils/jnpf"
  
  function getCurrentDate() {
            var currentDate = new Date();
            var dateString = currentDate.toDateString();
            console.log('这是在控制台输出的信息:'+dateString);

            var year = currentDate.getFullYear(); // 获取年份
            var month = currentDate.getMonth() + 1; // 获取月份（注意月份是从0开始的，所以需要加1）
            var day = currentDate.getDate().toString().padStart(2, '0'); // 获取日期
            // 格式化输出日期和时间
            var formattedDateTime = year + "-" + month + "-" + day ;
            return formattedDateTime;
  }

  export default {
    name: "PatrolSchedule",
    components: {},
    data() {
        return {
            scheduleData: {
                "2025-02-02": { content: "曹操奉1教楼101" },
                "2025-02-06": { content: "刘备奉综合楼201" },
                "2025-02-10": { content: "关羽奉1教楼110" },
                "2025-02-18": { content: "张飞奉1教楼501" },
                "2025-02-24": { content: "孙权奉1教楼101" },
                "2025-02-26": { content: "曹植奉综合楼701"},
                "2025-01-04": { content: "曹操奉1教楼101" },
                "2025-01-07": { content: "刘备奉综合楼201" },
                "2025-01-10": { content: "关羽奉1教楼110" },
                "2025-01-15": { content: "张飞奉1教楼501" },
                "2025-01-21": { content: "孙权奉1教楼101" },
                "2025-01-28": { content: "曹植奉综合楼701"},
            },
            //所属校区选择数据
            options1: [{
              value: '1',
              label: '第一教学楼'
            }, {
              value: '2',
              label: '化学楼'
            }, {
              value: '3',
              label: '综合实验楼'
            }],

            options2: [{
              value: '1',
              label: '一楼'
            }, {
              value: '2',
              label: '二楼'
            }, {
              value: '3',
              label: '三楼'
            }, {
              value: '4',
              label: '四楼'
            }],

        };
    },
    mounted() {},
    methods: {},
};
</script>

<!-- 参考网站 https://blog.csdn.net/rear0312/article/details/126367266 -->